package com.jixiantubu.adapter;

import image.SmartImageView;

import java.util.ArrayList;
import java.util.List;

import com.example.jixiantubu.R;
import com.jixiantubu.bean.Travelsbean;
import com.jixiantubu.jinnang.JinNang_YouJi_JuTiNeiRong;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class YouJiMuLuMuAdapter extends BaseAdapter {
	Context context;
	List<Travelsbean> list = new ArrayList<Travelsbean>();
	LayoutInflater mInflater;
	ViewHolder holder;

	public YouJiMuLuMuAdapter(Context context, List<Travelsbean> list) {
		super();
		this.context = context;
		this.list = list;
		mInflater = LayoutInflater.from(context);
	}

	public List<Travelsbean> getList() {
		return list;
	}

	public void setList(List<Travelsbean> list) {
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(final int arg0, View arg1, ViewGroup arg2) {
		Log.e("胡蛟龙", list.toString());
		holder = new ViewHolder();
		if (arg1 == null) {
			arg1 = mInflater.inflate(R.layout.jinnang_youji_mulu_item, null);
			holder.t_title = (TextView) arg1
					.findViewById(R.id.jinnang_youji_mulu_title);
			arg1.setTag(holder);
		} else {
			holder = (ViewHolder) arg1.getTag();

		}
		holder.t_title.setText(list.get(arg0).getT_tittle());
		Log.e("jiaojiao", list.get(arg0).toString());
		holder.t_title.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg7) {
				Intent intent = new Intent(context,
						JinNang_YouJi_JuTiNeiRong.class);
				intent.putExtra("neirong", list.get(arg0));
				context.startActivity(intent);
			}
		});

		return arg1;
	}

	public class ViewHolder {

		TextView t_title;
	}

}
